<template>
	<view>
		<view class="lists" v-for="item in newslist" :key='item.id' @click="nav(item.id)">
			<image :src="item.img_url" mode=""></image>
			<view class="sonlist">
				<view class="title">{{item.title}}</view>
				<view class="time">
					发表时间&nbsp;{{item.add_time.slice(0,10)}}&nbsp;&nbsp;&nbsp;浏览:&nbsp;{{item.click}}
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newslist:[]
			}
		},
		onLoad() {
			this.getnewslist()
		},
		methods: {
			async getnewslist(){
				const data =await uni.$http.get(`/getnewslist`)
				console.log(data)
				this.newslist=data.message
			},
			nav(id){
				// console.log(id)
				uni.navigateTo({
					url:`../getnew/getnew?id=${id}`
				})
			}
		}
	}
</script>

<style>
.lists{
	height: 200rpx;
	width: 100%;
	border-bottom:1px solid red ;
	display: flex;
	justify-content:space-between;
}
.lists>image{
	height: 100%;
	width: 200rpx;
}
.sonlist{
	height: 100%;
	width: 500rpx;
}
.title{
	width: 100%;
	height: 150rpx;
}
.time{
	font-size: 12px;
}
</style>
